home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Wipes reversed ƒ / Circular wipe reversed.c < prev    next >
Text File  |  1994-04-15  |  4KB  |  124 lines

  1. /**********************************************************************\
  2.  
  3. File:        Circular wipe reversed.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define CorrectTime 2
  28. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  29. #define theWindowWidth (boundsRect.right-boundsRect.left)
  30.  
  31. pascal short CircularWipeReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  32.  
  33. /* Trace a region from the center to the topleft corner, down <BlockSize> pixels,
  34.    and back to the center.  Fill that in and move the region parameters +BlockSize.
  35.    Repeat for all sides (counterclockwise). */
  36.  
  37. pascal short CircularWipeReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  38. {
  39.     RgnHandle    curregion;
  40.     int            cx,cy,lastx,lasty;
  41.     int            BlockSize;
  42.     
  43.     BlockSize=theWindowWidth/40;
  44.     cx = boundsRect.left + theWindowWidth / 2;
  45.     cy = boundsRect.top + theWindowHeight / 2;
  46.  
  47.     curregion=NewRgn();
  48.     lasty=boundsRect.top;
  49.     do                                            /* left quadrant */
  50.     {
  51.         StartTiming();
  52.         SetEmptyRgn(curregion);
  53.         MoveTo(cx,cy);
  54.         OpenRgn();
  55.             LineTo(boundsRect.left,lasty);
  56.             Line(0, BlockSize);
  57.             LineTo(cx,cy);
  58.         CloseRgn(curregion);
  59.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  60.             &boundsRect, &boundsRect, 0, curregion);
  61.         lasty+=BlockSize;
  62.         TimeCorrection(CorrectTime);
  63.     }
  64.     while (lasty<boundsRect.bottom);
  65.     
  66.     lastx=boundsRect.left;
  67.     do                                            /* bottom quadrant */
  68.     {
  69.         StartTiming();
  70.         SetEmptyRgn(curregion);
  71.         MoveTo(cx,cy);
  72.         OpenRgn();
  73.             LineTo(lastx,boundsRect.bottom);
  74.             Line(BlockSize, 0);
  75.             LineTo(cx,cy);
  76.         CloseRgn(curregion);
  77.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  78.             &boundsRect, &boundsRect, 0, curregion);
  79.         lastx+=BlockSize;
  80.         TimeCorrection(CorrectTime);
  81.     }
  82.     while (lastx<boundsRect.right);
  83.     
  84.     lasty=boundsRect.bottom;
  85.     do                                            /* right quadrant */
  86.     {
  87.         StartTiming();
  88.         SetEmptyRgn(curregion);
  89.         MoveTo(cx,cy);
  90.         OpenRgn();
  91.             LineTo(boundsRect.right,lasty);
  92.             Line(0,-BlockSize);
  93.             LineTo(cx,cy);
  94.         CloseRgn(curregion);
  95.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  96.             &boundsRect, &boundsRect, 0, curregion);
  97.         lasty-=BlockSize;
  98.         TimeCorrection(CorrectTime);
  99.     }
  100.     while (lasty>boundsRect.top-BlockSize);
  101.     
  102.     lastx=boundsRect.right;
  103.     do                                            /* top quadrant */
  104.     {
  105.         StartTiming();
  106.         SetEmptyRgn(curregion);
  107.         MoveTo(cx,cy);
  108.         OpenRgn();
  109.             LineTo(lastx,boundsRect.top);
  110.             Line(-BlockSize,0);
  111.             LineTo(cx,cy);
  112.         CloseRgn(curregion);
  113.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  114.             &boundsRect, &boundsRect, 0, curregion);
  115.         lastx-=BlockSize;
  116.         TimeCorrection(CorrectTime);
  117.     }
  118.     while (lastx>boundsRect.left-BlockSize);
  119.     
  120.     DisposeRgn(curregion);
  121.     
  122.     return 0;
  123. }
  124.